<!DOCTYPE html>
<html lang='en'>

<head>
    <meta charset='UTF-8'>
    <meta http-equiv='X-UA-Compatible' content='IE=edge'>
    <meta name='viewport' content='width=device-width, initial-scale=1.0'>
    <title>Document</title>
    <script src='../vue.js'></script>
    <style>
        .box{
            background-color: aqua;
        }
        .cox{
            background-color: yellowgreen;
        }
    </style>
</head>

<body>
    <div id='app'>
        <button @click="isHot=true">登录</button>
        <button @click="isHot=false">注册</button>
        <div>
            <h1>请{{isHot?"登录":"注册"}}</h1>
            <form action="###" v-if="isHot" class="box" key="box">
                <input type="text" name="username">
                <input type="password" name="password">
            </form>
            <form action="###" v-else class="cox" key="cox">
                <input type="text" name="username">
                <input type="password" name="password">
            </form>
        </div>
    </div>

    <script>
        Vue.config.productionTip = false;
        const vm = new Vue({
            el: '#app',
            data() {
                return {
                    isHot:true
                }
            }
        })
    </script>
</body>

</html>